package com.migu.spms.dao.inf;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.migu.spms.dao.entity.FunctionRequireCriteria;
import com.migu.spms.dao.entity.FunctionRequireDO;

import lombok.experimental.PackagePrivate;

/**   
* IFunctionRequireDO类
* 项目名称:  SPMS功能需求
* 包名称:    com.migu.spms.dao.inf   
* 类名称:    IFunctionRequireDO.java
* 类描述:    
* 创建人:    wcr   
* 创建时间:  2017年6月19日 上午11:29:10   
*/
@Repository(value = "IFunctionRequireDO")
public interface IFunctionRequireDO {
    int deleteByPrimaryKey(Long id);

    int insert(FunctionRequireCriteria record);

    int insertSelective(FunctionRequireCriteria record);

    FunctionRequireDO selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(FunctionRequireCriteria record);

    int updateByPrimaryKeyWithBLOBs(FunctionRequireCriteria record);

    int updateByPrimaryKey(FunctionRequireCriteria record);

    /**
     * 分页查询列表父需求
     */
    List<FunctionRequireDO> queryPage(FunctionRequireCriteria functionRequireCriteria);

    /**
     * 查询列表父需求总数量
     */
    int queryTotalNumberByCriteria(FunctionRequireCriteria functionRequireCriteria);

    /**
     * 根据父需求id查询关联表查询子需求(最新版本)
     * @return
     */
    List<FunctionRequireDO> selectSubListByCriteria(FunctionRequireCriteria functionRequireCriteria);

    /**
     * 根据需求id查询所有需求
     */
    List<FunctionRequireDO> selectListByRequireId(String requireId);

    /**
    * 根据criteria查询
    */
    FunctionRequireDO selectByCriteria(FunctionRequireCriteria functionRequireCriteria);

    void updateParentRequireFlag(Integer flag);

    /**
     * 根据criteria查询集合
     */
    List<FunctionRequireDO> selectListByCriteria(FunctionRequireCriteria functionRequireCriteria);

    /**
    * 根据分类ID查询数量
    * @param typeId
     * @param projectId 
    * @return
    * @exceptions
    * @throws
    */
    int selectCountByTypeTree(@Param(value = "typeId") String[] typeId, @Param(value = "projectId") Long projectId);

    /**
    * 
    * @param typeId
    * @return
    * @exception
    * @throws
    */
    int updateTypeByTreeId(@Param("typeId") String typeId, @Param("requireTypeId") String requireTypeId,
            @Param("requireTypeName") String requireTypeName);

    /**
     * 查询需求的关联需求的数量
     */
    int queryDetailsNumberByCriteria(FunctionRequireCriteria functionRequireCriteria);

    /**
     * 查询关联需求，并分页
     */
    List<FunctionRequireDO> queryPageByCorrelationRequire(FunctionRequireCriteria functionRequireCriteria);

    List<String> queryProcessInstanceIdList(String[] ids);

    void batchDeleteIds(String[] ids);

    void batchUpdateRequiremntSchedule(@Param(value = "ids") List<String> updateIds,
            @Param(value = "requireParam") FunctionRequireCriteria functionRequireCriteria);

    /**
     * 根据需求Id查询实体类
     */
    FunctionRequireDO selectRequireNameByCriteria(String requireId);

    /**
     * 模糊条件查询
     * @param functionRequireCriteria
     * @return
     */
    List<FunctionRequireDO> fuzzyKeyIsNotNull(FunctionRequireCriteria functionRequireCriteria);

    int fuzzyKeyIsNotNullNumber(FunctionRequireCriteria functionRequireCriteria);

    /**
    * @Title: selectAllBaseLined
    * @Description: 查询已经打基线的版本号
    * @param @return  
    * @return List<String>
    * @author le
    * @throws
    */
    List<String> selectAllBaseLined(Long projectId);

    /**
    * @Title: queryMaxBaseLine
    * @Description: 查询最大的版本号的基线
    * @param @param criteria
    * @param @return  
    * @return String
    * @author le
    * @throws
    */
    String queryMaxBaseLine(FunctionRequireCriteria criteria);

    int queryNumberByProjectId(@Param(value = "projectId") Long projectId);

    /**
    * @Title: selectAllIdByRequirementId
    * @Description: 根据需求主键id查询出所有基线版本的主键id
    * @param @param ids
    * @param @return  
    * @return List<String>
    * @author le
    * @throws
    */
    List<String> selectAllIdByRequirementId(String[] ids);

    List<FunctionRequireDO> selectExcelRequireList(FunctionRequireCriteria functionRequireCriteria);

    // 修改该需求的业务需求id
    void updateRelativeRequireId(FunctionRequireCriteria fr);

    List<FunctionRequireDO> queryRequireListByPrimaryKey(@Param(value = "functionRequireId") Long functionRequireId);

    // 查询所有功能需求的版本号
    List<String> queryAllBaseLineVersion(@Param(value = "keyword") String keyword,@Param(value="projectId") String projectId);

    // 分类条件
    List<FunctionRequireDO> selectSubListByParmeter(FunctionRequireCriteria functionRequireCriteria);

    /**
    * 
    * @param ff
    * @return
    * @exception
    * @throws
    */
    FunctionRequireDO selectByIdentifi(FunctionRequireCriteria ff);

    void batchUpdate(@Param(value = "ids") List<Long> ids,
            @Param(value = "planOnlineVersion") String planOnlineVersion);

    /**
    * 
    * @param string
    * @return
    * @exception
    * @throws
    */
    FunctionRequireDO selectByChangeHistory(String reqid);

    /**
     * 待我处理
     */
	List<FunctionRequireDO> queryPageByCurrent(FunctionRequireCriteria functionRequireCriteria);
	/**
	 * 待我处理数量
	 */
	int queryNumberByCurrent(FunctionRequireCriteria functionRequireCriteria);
	
	/**
	 * 我已处理数量
	 */
	int queryNumberByMyHadCurrent(FunctionRequireCriteria functionRequireCriteria);

	/**
	 * 我已处理
	 */
	List<FunctionRequireDO> queryPageByMyHadCurrent(FunctionRequireCriteria functionRequireCriteria);

	int fuzzyKeyIsNullTypeNotOneNumber(FunctionRequireCriteria functionRequireCriteria);

	List<FunctionRequireDO> fuzzyKeyIsNullTypeNotOne(FunctionRequireCriteria functionRequireCriteria);

	int queryNumberByCurrentAllRequire(FunctionRequireCriteria functionRequireCriteria);

	List<FunctionRequireDO> queryPageByCurrentAllRequire(FunctionRequireCriteria functionRequireCriteria);

	int queryNumberByMyHadCurrentAllRequire(FunctionRequireCriteria functionRequireCriteria);

	List<FunctionRequireDO> queryPageByMyHadCurrentAllRequire(FunctionRequireCriteria functionRequireCriteria);

	List<FunctionRequireDO> queryHomePageByWaitingHandle(FunctionRequireCriteria functionRequireCriteria);

    int queryHomePageByWaitingHandleCount(FunctionRequireCriteria functionRequireCriteria);
}